Advanced Architecting on AWS
KMS โข CloudHSM โข Envelope Encryption โข ACM โข Secrets Manager
| Key Type | Management | Rotation | Use Case |
|---|---|---|---|
| AWS Owned Keys | AWS manages entirely | Varies | Default encryption (S3 SSE-S3) |
| AWS Managed Keys | AWS creates per service (aws/s3, aws/ebs) | Auto (yearly) | Simple encryption without custom policy |
| Customer Managed Keys (CMK) | You create, manage policies | Configurable (90-2560 days) | Cross-account, custom policies, auditing |
| Imported Key Material | You provide key material | Manual only | Compliance requiring external key origin |
| Feature | KMS | CloudHSM |
|---|---|---|
| Management | Multi-tenant, AWS-managed | Single-tenant, customer-managed |
| HSM Type | FIPS 140-2 Level 3 | FIPS 140-2 Level 3 |
| Key access | AWS has administrative access | Only you have key access (AWS cannot recover) |
| Integration | Native AWS service integration | PKCS#11, JCE, OpenSSL, Microsoft CNG |
| Use case | Most encryption needs | Regulatory requirements, Oracle TDE, SSL offload |
| Pricing | Per-API call + per-key/month | ~$1.50/hr per HSM (minimum 2 for HA) |
AWS Certificate Manager
Free public SSL/TLS certificates. Auto-renewal. Integrates with ALB, CloudFront, API Gateway. Private CA available.
Secrets Manager
Store & rotate secrets (DB creds, API keys). Lambda rotation function. Cross-account sharing. Automatic rotation (30/60/90 days).
| Service | Encryption Method | Key Options |
|---|---|---|
| S3 | SSE-S3, SSE-KMS, SSE-C, client-side | Bucket keys reduce KMS costs |
| EBS | AES-256 (default encryption available) | AWS managed or CMK |
| RDS | AES-256 at volume level | Must enable at creation (immutable) |
| DynamoDB | AES-256 (always encrypted) | AWS owned, AWS managed, or CMK |
| EFS | AES-256 | Must enable at creation |
# Create a CMK aws kms create-key --description "Production encryption key" \ --key-usage ENCRYPT_DECRYPT --key-spec SYMMETRIC_DEFAULT # Generate a data key (envelope encryption) aws kms generate-data-key --key-id alias/prod-key \ --key-spec AES_256 # Enable automatic rotation aws kms enable-key-rotation --key-id alias/prod-key \ --rotation-period-in-days 90 # Grant cross-account access aws kms create-grant --key-id alias/prod-key \ --grantee-principal arn:aws:iam::222233334444:role/AppRole \ --operations Decrypt GenerateDataKey
Q1: An application encrypts files larger than 100MB before storing in S3. Which approach should it use?
A) Call KMS Encrypt API directly B) Envelope encryption with GenerateDataKey C) CloudHSM only D) Client-side encryption with AES library
Q2: A company's compliance requires that AWS cannot access their encryption keys under any circumstances. What should they use?
A) AWS Managed KMS key B) Customer Managed KMS key C) CloudHSM D) SSE-S3
KMS
AWS owned/managed/customer keys. Envelope encryption for large data. Cross-account grants. Key rotation.
CloudHSM
Single-tenant. Customer-only key access. PKCS#11. Oracle TDE, SSL offload. ~$1.50/hr/HSM.
ACM & Secrets
Free public certs with auto-renewal. Secrets Manager for credential rotation. Lambda-based rotation.
Encryption at Rest
S3: SSE-S3/KMS/C. EBS: default encryption. RDS: enable at creation. DynamoDB: always encrypted.